<?php

namespace widget;
use dk\core\Version;

class Profiler extends \dk\widget\Base {
    use \dk\traits\Singleton;

    /**
     * @param \weixin\core\View $plug
     */
    function bindHandle($plug) {
        $this->view = $plug;
        $plug->regPlug('profiler', array($this, 'render'));
    }

    /**
     * @param $files
     * @return string
     */
    function render($args = []){
        $profiler = service('dbprofiler');
        $data = [];
        if($profiler){
            $data['sqls'] = $profiler->getProfiles();
        }
   
        return $this->widgetTpl('profiler', $data, $args);
    }
}